package parser;
import antlr.RecognitionException;
import antlr.Token;

class AsgnExpr extends Expr {
    
    Expr left;
    Expr right;
    
    AsgnExpr(Expr left, Expr right) throws RecognitionException {
        left.lhs();
        this.left = left;
        this.right = right;
    }
     
    void write(ByteStream out) throws RecognitionException {
        right.write(out);
        out.write(Opcodes.COPY);
        left.writeLHS(out);
    }

    void delete(ByteStream out) throws RecognitionException {
        throw new RecognitionException("Cannot delete rvalue");
    }
    
    void writeLHS(ByteStream out) throws RecognitionException {
        throw new RecognitionException("Cannot assign to an assignment");
    }
    
}
